#include "HUD.h"
#include "Game.h"
#include "Player.h"

HUD::HUD()
{
    bg = new Image("images/hud.bmp");
	font = new NumericalBitmapFont("images/numbers.bmp");
}

void HUD::draw()
{
	int drawY = Window::getInstance()->getHeight() - bg->getHeight();
    bg->draw(0,drawY);

	Player* p = Game::getInstance()->getPlayer();

	glColor3ub(255,0,0);
	int healthWidth = (int) ( (float)p->getHealth() / PLAYER_MAX_HEALTH * HUD_HEALTHBAR_WIDTH );
	glRecti(HUD_HEALTHBAR_X, drawY + HUD_HEALTHBAR_Y, HUD_HEALTHBAR_X + healthWidth, drawY + HUD_HEALTHBAR_Y + HUD_HEALTHBAR_HEIGHT);

	font->drawNumber(HUD_SCORE_X, drawY+HUD_SCORE_Y, p->getScore());
}
